home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / program / swagg_m.zip / MAIL.SWG / 0019_Fidomsg.pas.pas < prev    next >
Pascal/Delphi Source File  |  1994-08-24  |  5KB  |  166 lines

  1. {
  2. Someone once posted a message with the header formats for Fido-style *.MSGs. I
  3. took that original message and added to it to get the following program. This
  4. program reads *.MSG files sequentially in your *.MSG directory. You can alter
  5. the program to do whatever you want.
  6. }
  7. uses dos,crt;
  8.  
  9. Type FidoHeader=record {structure of the Message Header}
  10.         WhoTheMessageIsFrom,
  11.         WhoTheMessageItTo   : Array[1..36] of Char; {ASCIIZ Strings}
  12.         MessageSubject      : Array[1..72] of Char;
  13.         MessageDate         : Array[1..20] of Char;
  14.                 {The Message Date is an ASCIIZ string following this
  15.                 format: DD MMM YY  HH:MM:SS<Null>-20 Characters Total
  16.                 Example: 01 Jun 94 20:00:00 is June 1st 1994 at 8:00PM
  17.                 But SeaDog uses a slightly different version and you
  18.                 might want to account for that, unfortunately I can't
  19.                 remember the exact format, also SLMAIL for SearchLight
  20.                 BBS only puts one space between the year and the hour
  21.                 even though it's supposed to be 2, I'm surprised this
  22.                 hasn't thrown mailers of other BBS programs}
  23.         TimesTheMessageWasRead,
  24.         DestinationNode,
  25.         OriginalNode,
  26.         CostofTheMessage,
  27.         OriginalNet,
  28.         DestinationNet      : Integer;
  29.                 {Note: TimesTheMessageWasRead & CostofTheMessage are
  30.                 usually ignored when being exported from the BBS and can
  31.                 be ignored when importing into a BBS}
  32.         DateWritten,
  33.         DateArrived         : LongInt;
  34.                 {I'm not sure how the dates are stored in here, but
  35.                 they're usually ignored}
  36.         MessageToWhichThisRepliesTo: Integer;{Irrevelant over a network}
  37.         Arrtibutes          : Word;
  38.                 {Bit Field:
  39.                     Bit 0 Private Message
  40.                         1 Crashmail
  41.                         2 Message Was Read
  42.                         3 Message Was Sent
  43.                         4 File Attatched, Filename in subject
  44.                         5 Forwarded Message
  45.                         6 Orphan Message ???
  46.                         7 Kill After Its Sent (I think)
  47.                         8 Message Originated Here (local)
  48.                         9 Hold
  49.                         10 Reserved
  50.                         11 File Request, Filenames in Subject
  51.                         12 Return Receipt Requested
  52.                         13 This message is a Return Receipt
  53.                         14 Audit Trail Requested
  54.                         15 Update Request }
  55.         UnReply             : Integer; {I have No Idea}
  56. End;
  57.  
  58. Type FidoMsg=record
  59.    msgchar : char;
  60. end;
  61.  
  62. {The Message Text follows terminated by either a Null (#0) or to Cr's #13#13.
  63. Also all paragraphs are supposed to end with a Hard CR (#141) and you can
  64. ignore any #13 and reformat the text for your own program, also any lines
  65. starting with ^A (#1) should not be imported into the BBS, they are control
  66. lines... the contents of these lines varies so you'll have to find out that on
  67. your own }
  68.  
  69. var
  70.   header : fidoheader;
  71.   headerf: file of fidoheader;
  72.   MsgTxt : FidoMsg;
  73.   MsgTxtf: file of FidoMsg;
  74.   DirInfo: SearchRec;
  75.   ch : char;
  76.   cr,count : shortint;
  77.   l : string;
  78.   howlong : byte;
  79. begin
  80.   FindFirst('*.MSG', Archive, DirInfo);
  81.   while DosError = 0 do
  82.   begin
  83.     window(1,1,80,25);
  84.     clrscr;
  85.     textcolor(lightgreen);
  86.     WriteLn(DirInfo.Name);
  87.     textcolor(green);
  88.     assign(headerf,DirInfo.Name);
  89.     reset(headerf);
  90.     read(headerf,header);
  91.     with header do
  92.     begin
  93.         Writeln('From:  ',WhoTheMessageIsFrom);
  94.         Writeln('To  :  ',WhoTheMessageItTo);
  95.         Writeln('Subj:  ',MessageSubject);
  96.         Writeln('Date:  ',MessageDate);
  97.     end;
  98.     textcolor(white);
  99.     Writeln('═══════════════════════════════════════════════════
  100. ════════════════════════');
  101.     window(1,wherey,80,25);
  102.     textcolor(cyan);
  103.     close(headerf);
  104.     assign(MsgTxtF,DirInfo.Name);
  105.     reset(MsgTxtF);
  106.     seek(MsgTxtF,sizeof(header));
  107.     cr := 0;
  108.     count := 0;
  109.     l := '';
  110.     repeat
  111.       read(MsgTxtF,MsgTxt);
  112.       ch := MsgTxt.msgchar;
  113.       if not (ch in [#10,#13]) then
  114.       begin
  115.         l := l + ch;
  116.         howlong := length(l);
  117.       end;
  118.       if length(l) > 78 then
  119.       begin
  120.         count := length(l);
  121.         while (count > 60) and (l[count] <> ' ') do dec(count);
  122.         writeln(l,copy(l,1,count));
  123.         delete(l,count,length(l));
  124.       end;
  125.       if ch = #13 then
  126.       begin
  127.         writeln(l);
  128.         l := '';
  129.         howlong := 0;
  130.       end;
  131.       if pos('these things?',l) > 0 then
  132.       begin
  133.         write
  134.       end;
  135.       (*
  136.       if wherey > 15 then
  137.       begin
  138.         textcolor(12);
  139.         writeln;
  140.         {
  141.         write('Press enter: ');
  142.         readln;
  143.         }
  144.         clrscr;
  145.         textcolor(cyan);
  146.       end;
  147.       *)
  148.     until eof(MsgTxtF) or (ioresult > 0);
  149.     if l > '' then
  150.     begin
  151.       writeln(l);
  152.       l := '';
  153.     end;
  154.     textcolor(11);
  155.     write('End of Msg: ');
  156.     textcolor(7);
  157.     readln;
  158.     clrscr;
  159.     FindNext(DirInfo);
  160.   end;
  161.   textcolor(7);
  162. end.
  163.  
  164. end.
  165.  
  166.